Show an error dialog when we can't read the folder's contents
authorFederico Mena Quintero <federico@novell.com>
Wed, 2 Sep 2009 18:43:03 +0000 (13:43 -0500)
committerBenjamin Otte <otte@gnome.org>
Thu, 15 Oct 2009 20:06:15 +0000 (22:06 +0200)
Signed-off-by: Federico Mena Quintero <federico@novell.com>
gtk/gtkfilechooserdefault.c

index dd835e988365a6bb3cf75547c8c7b07b7cce8825..caa201942c3c7d0cca7fda9abfb7f9767473a343 100644 (file)
@@ -6386,6 +6386,29 @@ pending_select_files_process (GtkFileChooserDefault *impl)
   g_assert (impl->pending_select_files == NULL);
 }
 
+static void
+show_error_on_reading_current_folder (GtkFileChooserDefault *impl, GError *error)
+{
+  GFileInfo *info;
+  char *msg;
+
+  info = g_file_query_info (impl->current_folder,
+                           G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+                           G_FILE_QUERY_INFO_NONE,
+                           NULL,
+                           NULL);
+  if (info)
+    {
+      msg = g_strdup (_("Could not read the contents of %s"), g_file_info_get_display_name (info));
+      g_object_unref (info);
+    }
+  else
+    msg = g_strdup (_("Could not read the contents of the folder"));
+
+  error_message (impl, msg, error->message);
+  g_free (msg);
+}
+
 /* Callback used when the file system model finishes loading */
 static void
 browse_files_model_finished_loading_cb (GtkFileSystemModel    *model,
@@ -6394,6 +6417,9 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel    *model,
 {
   profile_start ("start", NULL);
 
+  if (error)
+    show_error_on_reading_current_folder (impl, error);
+
   if (impl->load_state == LOAD_PRELOAD)
     {
       load_remove_timer (impl);